<script type="text/javascript">
    var aktif = false;

    function proses() {
        var p = $('#id_periode_thr_fk').val();
        // Pesan konfirmasi sebelum di proses
        $.messager.confirm('Notif', 'Apakah kamu yakin melakukan kalkulasi Gaji 13 periode ini?', function(r){
            if (r){
                if (p != '') {
                    $('#form_master').submitForm('/'+controller+'/ajax_post', { 
                        onComplete : function(){ 
                            // Fungsi ada di list_gaji.php
                            reloadListThr(p);
                        }
                    });
                } else{
                     $.messager.alert('Info','Silahkan pilih Periode terlebih dahulu!','info');
                };
            }
        });
    }

    function lihatGaji() {
        var p = $('#id_periode_thr_fk').val();
        reloadListThr(p);
    }

    function periodeTHR() {
        loadPage(gs_path + '/hrd_periode_thr');
    }

    $(document).ready(function() {
        // Setup Form
        $('#form_master').setupForm([
            { name: 'id_periode_thr_fk', size:'medium', noempty:true, data:<?php echo json_encode($listPeriodeThr); ?> }
        ], 
            <?php echo json_encode($data); ?>
        );

        // Create Tab
        $('#tt').tabs({ border:false });  
        
        // Focus at First Object
        $('#form_master').focusFirst();
    });
</script>

<div id="form_master_message" style="display:none;"></div>
<fieldset style="width:600px;">
<table class="tb_form" style="display:none; width:100%; " cellpadding="0" cellspacing="0" border="0">   
    <tr>
        <td class="label">Periode THR / Gaji 13</td>
        <td><input id="id_periode_thr_fk" /></td>
        <td colspan="2">
            <button class="easyui-linkbutton" iconCls="icon-add" onclick="periodeTHR()">Tambah Periode</button>
            <!-- <img src="/primkokas/files/people.png" width="125" height="150" border="3" style="float:right;">  -->
        </td>
    </tr>
    <tr><td><br></td></tr>
    <tr>
    	<td></td>
    	<td colspan="2">
            <button class="easyui-linkbutton" iconCls="icon-reload" onclick="proses()">Proses Hitung</button>
            <button class="easyui-linkbutton" iconCls="icon-search" onclick="lihatGaji()">Lihat Gaji 13</button>
        </td>
    </tr>
</table>
</fieldset>
<br>

<div id="tt" class="easyui-tabs" style="min-height:400px;"> 

    <div title="List Gaji 13 Karyawan" style="overflow:auto;padding:10px;">  
        <?php require_once('list_g13.php'); ?>
    </div> 
    
</div>